package com.leoman.permissions.admin.dao;

import com.leoman.permissions.admin.entity.Admin;
import com.leoman.common.dao.IBaseJpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;

import javax.persistence.QueryHint;
import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface AdminDao extends IBaseJpaRepository<Admin> {

    @Query("select a from Admin a where a.mobile = ?1")
    public Admin findByMobile(String mobile);

    @Query("select a from Admin a where a.mobile = ?1 and a.id != ?2")
    public Admin findByMobileAndId(String mobile, Long id);

    @Query("select a from Admin a where a.roleId = ?1")
    public List<Admin> findByRoleId(Long roleId);
}
